package com.yc.service;

import com.yc.entity.StockEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author yangc91@bngrp.com
 * @date 2020/8/6 14:34
 */
@Service
public class VoService {
    @Autowired
    private IStockService stockService;
    @Autowired
    private IOrderService orderService;

    public String bug() {
        try {
            StockEntity stockEntity=stockService.get(1);
            Long num = stockEntity.getNum();
            if (num>0){
                stockService.update_1Num(stockEntity.getId());
                orderService.insertOrder(stockEntity.getId());
            }
        } catch (Exception e) {
            e.printStackTrace();
            return "999";
        }
        return "success";
    }
}
